package com.example.userspringboot.controller;

import com.example.userspringboot.common.Result;
import com.example.userspringboot.entity.User;
import com.example.userspringboot.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    UserService userService;

    @PutMapping("/update")
    public Result update(@RequestBody User user)  //@RequestBody 接收前端传来的json数据
    {
        userService.update(user);
        return Result.success();//不需要返回数据，不用传递
    }

    @PostMapping("/updatePassword")
    public Result updatePassword(@RequestBody User user){
        userService.updatePassword(user);
        return Result.success();
    }

}
